<template>
  <div @click="handleTitleClick">
    <p>{{ title }}</p>
  </div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref } from "vue";
const emits = defineEmits(["getChild"]);
const props = defineProps({
  title: {
    type: String,
    defaule: "默认strin",
  },
});

const msg = ref("msg");

const handleTitleClick = () => {
  emits("getChild", "set parent value");
};

// defineExpose无需导入，直接使用 暴露给父组件使用
defineExpose({
  msg,
});
console.log("parent value:" + props.title);
</script>
<style lang="scss" scoped></style>
